package com.cgbl.cg.adapter

import android.os.Bundle
import com.cgbl.cg.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.configs.AppConstants
import com.robot.base.model.WorksBean
import com.robot.base.util.arouter.ARouterUtil
import com.robot.base.utils.pic.ImageLoaderUtils

class WorksRecommendAdapter(val visit: Boolean = false) :
    BaseQuickAdapter<WorksBean, BaseViewHolder>(R.layout.app_item_works_recommend) {
    override fun convert(holder: BaseViewHolder, item: WorksBean) {
        holder.setText(R.id.item_tv_content, item.workName)
        holder.setText(R.id.tv_zan_count, item.likeCount ?: "0")
        holder.setGone(R.id.item_tv_tag, item.hot == "1")
            .setText(R.id.item_tv_name, item.nickName)


        ImageLoaderUtils.displayRound(
            context, holder.getView(R.id.item_iv_img), item.coverImages, 4
        )
        ImageLoaderUtils.displayCirclePortrait(
            context, holder.getView(R.id.item_iv_avatar), item.head
        )

        holder.itemView.setOnClickListener {
            ARouterUtil.goToActivityWithBundle(AppConstants.Router.WORK.A_WORK_DETAIL,
                Bundle().apply {
                    putString("id", item.id)
                }
            )
        }
    }

}